<template>
  <div class="father">
    <h3>父组件</h3>
    <div class="content">

      <Category>
        <!--
           这里没有指定名称，也绑定不到默认的插槽上面
           我勒个乖乖 指定插槽名称竟然是要冒号指定 
           而定义插槽等于谁是  拿到插槽的对象，
           这里指定了s1 那么  还有一个插槽 s2 就没有被绑定
          -->
        <!-- <template v-slot:s1>
          <ul>
            <li v-for="g in games " :key="g.id"> {{ g.name}} </li>
          </ul>
        </template> -->

        <template v-slot:s2>
            <ul>
              <li v-for="g in games" :key="g.id">{{ g.name}}</li>
            </ul>
        </template>
        <template v-slot:s1>
          <h2>热门游戏</h2>
        </template>

      </Category>

      <Category>
        <template v-slot:s2>
            <img :src="imgUrl" alt="hahahah">
        </template>

        <template v-slot:s1>
          <h2>美食城市</h2>
        </template>
      </Category>
      
      <Category>
        <template v-slot:s2>
          <video :src="videoUrl"></video>
        </template>
        <template v-slot:s1>
            <h2>今日影视推荐</h2>
        </template>
      </Category>


    </div>
  </div>
</template>

<script setup lang="ts" name="Father">
  import {reactive ,ref} from 'vue'
  import Category from './Category.vue';

  let games = reactive([
    {id:'asgytdfats01',name:'英雄联盟'},
    {id:'asgytdfats02',name:'王者农药'},
    {id:'asgytdfats03',name:'红色警戒'},
    {id:'asgytdfats04',name:'斗罗大陆'}
  ])


  let imgUrl = ref('https://z1.ax1x.com/2023/11/19/piNxLo4.jpg')
  let videoUrl = ref('http://clips.vorwaerts-gmbh.de/big_buck_bunny.mp4')
</script>

<style scoped>
  .father {
    background-color: rgb(165, 164, 164);
    padding: 20px;
    border-radius: 10px;
  }
  .content {
    display: flex;
    justify-content: space-evenly;
  }
  img,video {
    width: 100%;
  }
  h2 {
    background-color: orange;
    text-align: center;
    font-size: 20px;
    font-weight: 800;
  }
</style>